import request from '@/utils/httpRequest'

export const freeCollection = {
  // 活动列表
  freeCheapList: function(param) {
    const res = request({
      url: `/bsnl-product/free_cheap/list`,
      method: 'post',
      data: param || {}
    })
    return res
  },
  //活动新增
  freeCheapAdd: function(data) {
    const res = request({
      url: `/bsnl-product/free_cheap`,
      method: 'post',
      data: data || {}
    })
    return res
  },
  // 活动详情
  freeCheapDetail: function(param) {
    const res = request({
      url: `/bsnl-product/free_cheap/${param.discountId}`,
      method: 'get',
      params: param || {}
    })
    return res
  },
  //活动编辑
  freeCheapEdit: function(data) {
    const res = request({
      url: `/bsnl-product/free_cheap/${data.discountId}`,
      method: 'put',
      data: data || {}
    })
    return res
  },
  //检查商品是否参与其他活动
  freeCheapCheck: function(data) {
    const res = request({
      url: `/bsnl-product/free_cheap/check`,
      method: 'post',
      data: data || {}
    })
    return res
  },
  // 配置列表
  freeCheapSetList: function(param) {
    const res = request({
      url: `/bsnl-product/free_cheap/setting`,
      method: 'get',
      params: param || {}
    })
    return res
  },
  // 编辑配置
  freeCheapSetDeit: function(param) {
    const res = request({
      url: `/bsnl-product/free_cheap/setting/${param.id}`,
      method: 'put',
      params: param || {}
    })
    return res
  },
}
